#ifndef APP_EDIT_CTRL_H
#define APP_EDIT_CTRL_H

    #include<gui_color.h>
    #include<gui_text.h>

    //text data buffer
    typedef struct 
    {
        uint8_t *buff;
        uint32_t len;
    }edit_buff_t;

    typedef struct edit_ctrl 
    {
        edit_buff_t buff_data;
        uint8_t *cur_buff_pos;  //current character write buffer postion
        uint64_t char_counts;
        gui_color_t back_color;
        gui_color_t font_color;
        int char_width;
        int char_height;
        int width;
        int height;
        uint64_t rows; //row counts
        uint64_t columns; //colums counts
        uint64_t row_height; //row pixel height
        uint64_t column_width; //column pixel width


        char file_name[MAX_PATH_LEN]; //file name
        char cur_cwd[MAX_PATH_LEN];  //work dir

        void (*flush)();
        void (*outchar)(char ch);
        void (*outstr)(char *str);
    }edit_ctrl_t;

    extern edit_ctrl_t edit_ctrl;

    //scroll ctrl
    #define EDIT_CTRL_SCROLL_DOWN 0
    #define EDIT_CTRL_SCROLL_UP  1

    #define EDIT_TEXT_WIDTH gui_text_char_width()
    #define EDIT_TEXT_HEIGHT gui_text_char_height()
#endif 